package com.soecode.wxtools.bean;

import com.alibaba.fastjson.JSONObject;
import com.soecode.wxtools.util.xml.XStreamTransformer;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;

@Data
@XStreamAlias("xml")
public class WxUnifiedOrder {

    @XStreamAlias("appid")
    private String appid;

    @XStreamAlias("mch_id")
    private String mchId;

    @XStreamAlias("device_info")
    private String deviceInfo;

    @XStreamAlias("nonce_str")
    private String nonceStr;

    @XStreamAlias("sign")
    private String sign;

    @XStreamAlias("body")
    private String body;

    @XStreamAlias("detail")
    private String detail;

    @XStreamAlias("attach")
    private String attach;

    @XStreamAlias("out_trade_no")
    private String outTradeNo;

    @XStreamAlias("fee_type")
    private String feeType;

    @XStreamAlias("total_fee")
    private String totalFee;

    @XStreamAlias("spbill_create_ip")
    private String spbillCreateIp;

    @XStreamAlias("time_start")
    private String timeStart;

    @XStreamAlias("time_expire")
    private String timeExpire;

    @XStreamAlias("goods_tag")
    private String goodsTag;

    @XStreamAlias("notify_url")
    private String notifyUrl;

    @XStreamAlias("trade_type")
    private String tradeType;

    @XStreamAlias("product_id")
    private String productId;

    @XStreamAlias("limit_pay")
    private String limitPay;

    @XStreamAlias("openid")
    private String openid;


    public String toXml() {
        return XStreamTransformer.toXml(WxUnifiedOrder.class, this);
    }

    public String toJson() {
        return JSONObject.toJSONString(this);
    }
}
